package com.yonyou.pmclouds.workstopreport.process;

import com.yonyou.pmclouds.basecom.billstatus.BillStatusConst;
import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.project.rmiitf.ProjectMaintain;
import com.yonyou.pmclouds.workstopreport.entity.WorkStopVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WorkStopWriteBackProjectProcessor implements SingleProcessor<WorkStopVO> {

    @Autowired
    private ProjectMaintain projectMaintain;

    @Override
    public void process(WorkStopVO vo, WorkStopVO orig) throws BusinessException {
        if(vo.getBillstatus().equals(BillStatusConst.COMMON_APPROVED_STATUS)){
            //回写项目的预计复工日期
            projectMaintain.updatePreWorkResumeDate(vo.getPkProject(),vo.getPreresumeDate(),vo.getStopDate());
        }
    }
}
